<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="admin.member.MemberModel" %>
<%@ page import="comm.JongTaeUtil"%>
<%@ page import="java.util.ArrayList"%>
<%@ page import="java.util.HashMap"%>
<jsp:useBean id="member" class="admin.member.MemberDao" scope="page"/>
<%

	String menu = "6";
	if ( request.getMethod().equals("GET") ) {
		//response.sendRedirect("member_01.jsp");
	}

	HashMap	paramMap = new HashMap();
	String	pageName = "lst.jsp";
	int		giSelectPage  	= Integer.parseInt(request.getParameter("txtSelectPage") == null ? "0" :request.getParameter("txtSelectPage"));			//현재 선택된 페이지 저장
	int		giSelectBlock 	= Integer.parseInt(request.getParameter("txtSelectBlock") == null ? "0" :request.getParameter("txtSelectBlock"));			//현재 선택된 블락페이지 저장
	String	searchGubn		= request.getParameter("searchGubn") == null ? "" : request.getParameter("searchGubn");
	String	searchValue		= request.getParameter("searchValue") == null ? "" : request.getParameter("searchValue");
	String	id				= request.getParameter("id") == null ? "" : request.getParameter("id");
	String  mode = request.getParameter("mode") == null ? "I" : request.getParameter("mode"); 
	
	paramMap.put("id",id);
	
	ArrayList returnList	=  member.getView(paramMap);
	MemberModel model	= new MemberModel();
	
	if(returnList != null && returnList.size() > 0){
		mode  = "U";
		model = (MemberModel)returnList.get(0);		
	}
	
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ko">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>황인영의 웨딩스토리</title>
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/js/default.js"></script>
<script type="text/javascript" src="/js/common.js"></script>
<script type="text/javascript" src="/js/ajax.js"></script>
<script type="text/javascript">
	var id_chkk = false;

	function doSubmit(){
		
		var form = document.wedding_form;
		<% if ( mode.equals("I") ) { %>
		if ( !id_chkk ){
			
			alert("아아디 중복 확인을 해주세요.");
			form.hiddenid.focus();
			return;
			
		}
		<% } %>
		if (validate(form)) {
			
			if ( form.pwd.value != form.pwd_re.value ){
				
				alert("비밀번호가 일치하지 않습니다.");
				form.pwd_re.focus();
				return;
				
			} 
			form.action = "member_dbx.jsp";
			form.submit();
			
		}
		
	}
	
	function open_zipcode(){	
		
		window.open("/admin/common/zipcode.jsp","","width=500,height=400,toolbar=no,menubar=no,location=no,scrollbars=yes");
		
	}
	
	function id_chk(){
		
		var form = document.wedding_form;
		
		if ( form.hiddenid.value == "" ){
			
			alert("아이디를 입력하세요.");
			form.hiddenid.focus();
			return;
			
		}
		
		var request = getXMLHttpRequest();
		var params	= "id="+form.hiddenid.value;
		sendRequest("member_id_dbx.jsp",params, idResult,"POST" );
		
	}
	
	function idResult(){
		
		if (httpRequest.readyState == 4) {
			
			if (httpRequest.status == 200) {
			
				var resultXML 	= httpRequest.responseXML;					
				var check 		=  resultXML.getElementsByTagName("code")[0].firstChild.nodeValue;
				
				if ( eval(check) ){
					
					alert("사용 가능한 아이디입니다.");
					id_chkk = true;
					
				} else {
					
					alert("사용 할 수 없는 아이디입니다.");
					id_chkk = false;
					
				}
			
			}
	}
		
	}
</script>
<!--[if lte IE 6]><link rel="stylesheet" href="css/ie6.css" type="text/css" media="all" /><![endif]-->
<!--[if lte IE 7]><link rel="stylesheet" href="css/ie7.css" type="text/css" media="all" /><![endif]-->
</head>
<body>
<!-- header -->
<%@ include file="/inc/header.jsp" %>
<!-- header// -->

<!-- container -->
<form name="wedding_form" method="post" />
	<input type="hidden" name="mode" value="<%=mode %>" /> 
	<input type="hidden" name="id" value="<%=id %>" />
    <div id="join_container" class="pdb100">
    	<% if ( mode.equals("U") ){ %>
    	<h2><img src="../img/mypage.gif" alt="마이페이지" /></h2>
        <div class="sub-con">
        <ul class="tab05">
        <li class="one"><a href="#" onclick="document.wedding_form.submit();return false;" class="hover">First Marriage</a></li>
        <li class="two"><a href="member_del.jsp">Remarriage</a></li>
        </ul>
        <p><img src="../img/mypage_img02.gif" alt="입력하신 정보는 회원님의 동의없이 공개되지 않으며, 개인정보보호정책에 의해 보호를 받습니다. 휴대폰번호는 맞춤상담을 위해 필요하오니 정확하게 기재해 주시기 바랍니다." /></p>
        <% } else { %>
        <h2><img src="../img/join_h2.gif" alt="회원가입" /></h2>
        <div class="sub-con">
            <img src="../img/join_img02.gif" alt="2. 개인정보입력" />
            <img src="../img/join_img06.gif" alt="2. 개인정보입력" class="pdt40" />
        <% }  %>
				<div class="view01">
                <table summary="제목,등록일,첨부파일,조회수를 제공한 표">
					<caption>뉴스</caption>
					<colgroup>
						<col width="18%" />
						<col width="82%" />
					</colgroup>
					<tr>
						<th scope="row" >* 회원아이디</th>
						<td>
							<% 
								if ( !model.getId().equals("") ){ 
								
									out.println(model.getId());
							%>
									<input type="hidden" name="id" value="<%=id%>"/>
							<%
								} else {
							%>
							
							<input type="text" name="hiddenid" class="w200" title="회원아이디 입력" REQUIRED="REQUIRED" hname="아이디" maxlength="10"/>
							<a href="#" onclick="id_chk();return false;"><img src="../img/btn_check.gif" alt="중복확인" /></a>
							<% }  %>
						</td>
					</tr>
					<tr>
						<th scope="row" >* 비밀번호</th>
						<td><input type="password" name="pwd" class="w200" title="비밀번호 입력" <%if ( mode.equals("I") ){ %> REQUIRED="REQUIRED" hname="비밀번호" <% } %>maxlength="12" OPTION="passwd"/> 
	                        <span class="text11">
	                        	<%
	                        		if ( mode.equals("I") ){
	                        			out.println("영문/숫자/특수문자 4~12자");
	                        		} else {
	                        			out.println("비밀번호 변경시에만 입력하세요.영문/숫자/특수문자 4~8자");
	                        		}
	                        	%>
	                        </span>
                        </td>
					</tr>
					<tr>
						<th scope="row" >* 비밀번호확인</th>
						<td><input type="password" name="pwd_re" class="w200" title="비밀번호확인 입력" maxlength="12" />
                        <span class="text11">비밀번호를 한번 더 입력하세요.</span></td>
					</tr>
					<tr>
						<th scope="row" >* 성명(한글)</th>
					  <td><input type="text" name="name" value="<%=model.getName() %>" class="w200" title="성명 입력" REQUIRED="REQUIRED" hname="성명" maxlength="10"/></td>
					</tr>
					<tr>
						<th scope="row" >* 생년월일</th>
					  <td>
					  <% 
					  	java.util.Calendar cal = java.util.Calendar.getInstance();
					  	
					  	int year = cal.get(java.util.Calendar.YEAR);
					  	int date = cal.getMaximum(java.util.Calendar.DATE);
					  	
					  	String tmp_year		= "";
					  	String tmp_month	= "";
					  	String tmp_day		= "";
					  	
					  	if ( model.getJumin().length() >= 6 ) {
					  		
					  		tmp_year = model.getJumin().substring(0,4);
					  		tmp_month = model.getJumin().substring(4,6);
					  		tmp_day = model.getJumin().substring(6);
					  		
					  	}
					  	
					  %>				  
                        <select name="birthday1" REQUIRED="REQUIRED" hname="년도">
                            <option>년도선택</option>
                            <%
                            	for(int i = year-60; i < year; i++){
                            %>
                            		<option value="<%=i%>" <%=JongTaeUtil.selected(tmp_year,String.valueOf(i)) %>><%=i %>년</option>
                            <%		
                            	}
                            %>
                        </select>
                        <select name="birthday2" REQUIRED="REQUIRED" hname="월">
                        	<option>월선택</option>
                            <%
                            	for(int i = 1; i <= 12; i++){
                            %>
                            		<option value="<%= i > 9 ? i : "0"+i%>" <%=JongTaeUtil.selected(tmp_month,i > 9 ? String.valueOf(i) : "0"+i) %>><%=i %>월</option>
                            <%		
                            	}
                            %>
                        </select>
                        <select name="birthday3" REQUIRED="REQUIRED" hname="일">
                        	<option>일선택</option>
                             <%
                            	for(int i = 1; i <= date; i++){
                            %>
                            		<option value="<%= i > 9 ? i : "0"+i%>" <%=JongTaeUtil.selected(tmp_day, i > 9 ? String.valueOf(i) : "0"+i) %>><%=i %>일</option>
                            <%		
                            	}
                            %>
                        </select>
                      </td>
					<tr>
						<th scope="row" >* 성별</th>
						<td><input type="radio" id="" name="sex" value="M" class="bor-n" <%=JongTaeUtil.checked(model.getSex(),"M") %> /><span class="pdr10">남자</span>
                        <input type="radio" id="" name="sex" value="F"class="bor-n" <%=JongTaeUtil.checked(model.getSex(),"F") %>/>여자</td>
					</tr>
					<tr>
						<th scope="row" >* 이메일</th>
						<td><input type="text" name="email" value="<%=model.getEmail() %>" class="w200" id="contactus04" title="이메일 입력" REQUIRED="REQUIRED" hname="이메일" maxlength="20"/> 
                        <span class="text11">예) webmaster@sksports.net</span></td>
					</tr>
					<tr>
						<th scope="row" >* 휴대폰번호</th>
					  <td>
					   <%
		              		String hp1 = "";
		              		String hp2 = "";
		              		String hp3 = "";
		              		
		              		
		              		
		              		if ( model.getHp().length() == 11){
		              			
		              			hp1 = model.getHp().substring(0,3);
		              			hp2 = model.getHp().substring(3,7);
		              			hp3 = model.getHp().substring(7);
		              			
		              		} else if ( model.getHp().length() == 10 ) {
		              			
		              			hp1 = model.getHp().substring(0,3);
		              			hp2 = model.getHp().substring(3,6);
		              			hp3 = model.getHp().substring(6);
		              			
		              		}
		              		
		              %>			
                        <select name="hp1">
                            <option value="010" <%=JongTaeUtil.checked(hp1,"010") %>>010</option>
							<option value="011" <%=JongTaeUtil.checked(hp1,"011") %>>011</option>
							<option value="016" <%=JongTaeUtil.checked(hp1,"016") %>>016</option>
							<option value="017" <%=JongTaeUtil.checked(hp1,"017") %>>017</option>
							<option value="018" <%=JongTaeUtil.checked(hp1,"018") %>>018</option>
							<option value="019" <%=JongTaeUtil.checked(hp1,"019") %>>019</option>
                        </select>
                        -
                        <input type="text" class="w70" name="hp2" value="<%=hp2 %>" title="휴대폰전화 입력" REQUIRED="REQUIRED" hname="휴대폰" onkeyup="isNumeric(this)" maxlength="4"/> 
                        -
                        <input type="text" class="w70" name="hp3" value="<%=hp3 %>" title="휴대폰전화 입력" REQUIRED="REQUIRED" hname="휴대폰" onkeyup="isNumeric(this)" maxlength="4"/> 
                        <a href=""><img src="../img/btn_cell.gif" alt="휴대폰인증" /> </a>
                      </td>
					</tr>
					<tr>
						<th scope="row" >* 주소</th>
						<td>
						<%
	              	
			              	String zip_code1 = "";
			              	String zip_code2 = "";
			              	
			              	if ( model.getZipcode().length() >= 6 ) {
			              		
			              		zip_code1 = model.getZipcode().substring(0,3);
			              		zip_code2 = model.getZipcode().substring(3);
			              		
			              	}
			              
			              %>
                        <input type="text" name="zipcode1" id="zipcode1" class="w70 mgb5" title="우편번호" REQUIRED="REQUIRED" hname="우편번호" onkeyup="isNumeric(this)" readonly="readonly" value="<%=zip_code1%>"/> 
                        -
                        <input type="text" name="zipcode2" id="zipcode2" class="w70 mgb5" title="우편번호" REQUIRED="REQUIRED" hname="우편번호" onkeyup="isNumeric(this)" readonly="readonly" value="<%=zip_code2%>"/>
                        <a href="#" onclick="open_zipcode();return false;"><img src="../img/btn_zip.gif" alt="우편번호검색" class="mgb5" /></a><br />
                        <input type="text" name="addr1" id="addr1" class="w200" id="" title="주소 입력" REQUIRED="REQUIRED" hname="주소" readonly="	readonly" value="<%=model.getAddr1()%>"/>
                        <input type="text" name="addr2" <% if ( mode.equals("I") ) { %>style="background: transparent url(../img/mypage_img03.gif) no-repeat scroll 3px 3px; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;" onkeydown="clrImg(this)" <%} %> onclick="clrImg(this)" id="searchBox" name="keyword"class="w250" REQUIRED="REQUIRED" hname="상세주소" value="<%=model.getAddr2()%>"/>
                        </td>
					</tr>
					<tr>
						<th scope="row" >* 결혼여부</th>
						<td><input type="radio" id="" name="wedding_yn" <%=JongTaeUtil.checked(model.getWedding_yn(),"Y") %> value="Y" class="bor-n" /><span class="pdr10">초혼</span>
                        <input type="radio" id="" name="wedding_yn"<%=JongTaeUtil.checked(model.getWedding_yn(),"N") %> value="N"class="bor-n" />재혼</td>
					</tr>
					<tr>
						<th scope="row" >최종학력</th>
						<td>
                        <select name="academic" >
					      		<option value="">선택</option>
					      		<option value="1" <%=JongTaeUtil.selected(model.getAcademic(),"1") %>>고등학교졸</option>
					      		<option value="2" <%=JongTaeUtil.selected(model.getAcademic(),"2") %>>전문대</option>
					      		<option value="3" <%=JongTaeUtil.selected(model.getAcademic(),"3") %>>대학교</option>
					      		<option value="4" <%=JongTaeUtil.selected(model.getAcademic(),"4") %>>대학원(재학중)</option>
					      		<option value="5" <%=JongTaeUtil.selected(model.getAcademic(),"5") %>>대학원(중퇴)</option>
					      		<option value="6" <%=JongTaeUtil.selected(model.getAcademic(),"6") %>>대학원(졸업)</option>
					      		<option value="7" <%=JongTaeUtil.selected(model.getAcademic(),"7") %>>박사이상</option>
					      		<option value="8" <%=JongTaeUtil.selected(model.getAcademic(),"8") %>>기타</option>
					     </select>
                        </td>
					</tr>
					<tr>
						<th scope="row" >상담가능시간</th>
						<td>
                        
                        <select name="advice_date" >
				      		<option value="">선택</option>
				      		<option value="월" <%=JongTaeUtil.selected(model.getAdvice_date(),"월") %>>월</option>
				      		<option value="화" <%=JongTaeUtil.selected(model.getAdvice_date(),"화") %>>화</option>
				      		<option value="수" <%=JongTaeUtil.selected(model.getAdvice_date(),"수") %>>수</option>
				      		<option value="목" <%=JongTaeUtil.selected(model.getAdvice_date(),"목") %>>목</option>
				      		<option value="금" <%=JongTaeUtil.selected(model.getAdvice_date(),"금") %>>금</option>
				      		<option value="토" <%=JongTaeUtil.selected(model.getAdvice_date(),"토") %>>토</option>
				      		<option value="일" <%=JongTaeUtil.selected(model.getAdvice_date(),"일") %>>일</option>
					    </select>
                        
                        <input type="text" name="advice_time" value="<%=model.getAdvice_time() %>" class="w200" id="" title="상담시간" />
                        <span class="text11">예) 17시~18시30분</span></td>
					</tr>
				</table>
                <div class="btn-center pdb100">
                <a href="#" onclick="doSubmit(); return false;"><img src="../img/btn_ok01.gif" alt="확인" /></a>
                <a href=""><img src="../img/btn_cancle.gif" alt="취소" /></a>
                </div>
                
                </div>
        </div>
	</div>

<!-- footer -->
<%@ include file="/inc/footer.jsp" %>
<!-- fooer// -->
	</div>
</div>

<!-- container// -->
</form>

</div>
</div>
</div>
</body>
</html>
